<template>
<Tree :data="data" @on-select-change="handleSelectChang"></Tree>
</template>
<script>
    export default {
        data () {
            return {
                data: [
                    {
                        title: '治疗一室',
                        expand: true,
                        children: [
                            {
                                title: '308'
                            },
                            {
                                title: '全身311'
                            }
                        ]
                    },
                    {
                        title: '治疗二室',
                        expand: true,
                        children: [
                            {
                                title: '药浴'
                            },
                            {
                                title: '激光点阵'
                            }
                        ]
                    },
                    {
                        title: '治疗三室',
                        expand: true,
                        children: [
                            {
                                title: 'DSD超频深磁治疗'
                            },
                            {
                                title: '手足熏蒸'
                            }
                        ]
                    },
                    {
                        title: '治疗四室',
                        expand: true,
                        children: [
                            {
                                title: '黑色素细胞种植治疗'
                            },
                            {
                                title: 'HN促黑光疗'
                            },
                            {
                                title: '自血疗法'
                            },
                            {
                                title: '透药'
                            }
                        ]
                    }
                ]
            }
        },
        methods: {
            handleSelectChang (item) {
                console.log(item);
                if (item[0]) {
                    item[0].expand = !item[0].expand;
                }
                item[0].selected = !item[0].selected;
            }
        }
    }
</script>
